1. Field of the Invention
This invention relates to compiling technology which converts a high level language, such as C language, to a machine language, especially a system for compiling programs, a method for compiling programs and a computer program product for compiling programs, in which a fixed-point data type can be defined at the start of the compiling operation or during the operation.
2. Description of the Related Art
It is well known that processing in fixed-point data type, instead of a floating point data type, provides resultant data speedily and precisely enough when operating multimedia data including audio and video data.
Most of the prior art compilers cannot directly process the fixed-point data type. Therefore, when the fixed-point data type is operated, the fixed-point data type is converted into the integer data type at an input or an output of a source program, and is processed as the integer data type when operating programs. Alternatively, the fixed-point data is processed by means of a user-defined function by using, for example, the integer data type.
Another compiler for operating the fixed-point data is known in which the compiler's processor has an installed designated circuit for operating the fixed-point data or a circuit for supporting operation (see User's Manual “C compiler for CC77016 μ PD77016”, NEC Electric Corp, published on January, 2003, Page 48-Page 51).
A compiler for a system design language “System C”, in which hardware can be described by means of a class of a C++ language, can process the fixed-point data type as C++ class. Furthermore the compiler can change the data type. However, even if the compiler can handle fixed-point data, that fixed-point data is tailored to the processor's specification. Also, it is difficult for the compiler, which is for the processor that does not handle fixed-point data by default (i.e. the processor that calculates fixed-point data by instructions which are not for fixed-point operations), or the processor that can add user defined modules can handle fixed-point data, to change the fixed-point data type according to user's requests.
Concretely speaking, as a first problem, in the case that users treat the fixed-point data as the integer data in a program, or users prepare functions which operate fixed-point operations, the term of programming programs becomes longer, the maintainability or reusability become worse because the descriptions for the fixed-point data are same as those of the integer data.
In operating a source program, only the fixed-point data are partially different from the original program, which decreases maintainability and causes difficulty of reusing the program.
As a second problem, the compiler, which is for the processor that can handle the fixed-point data or has the other processor can handle it, can handle the fixed-point data, however, that fixed-point data may have the excessive accuracy because such a fixed-point data type is fixed (i.e. not changed). Then, there is a problem that the performance falls down, or the size of object generated by the compiler becomes bigger.
As a third problem, the operations of C++ class objects are compiled to function calls by a C++ compiler, so fixed-point operations in a System C program are also compiled to function calls. Therefore, even if the processor has instructions which can handle fixed-point data, the compiler cannot generate them for the fixed-point operations.